home *** CD-ROM | disk | FTP | other *** search
/ Hyper Stacks 1994 May / Hyper Stacks (Pacific HiTech)(1994)[Mac].iso / Organization / HyperType / Exported Scripts – 1.5 next >
Text File  |  1992-12-07  |  18KB  |  776 lines

  1. This document reads best when displayed in a mono-spaced font
  2.  
  3. Exported using the Power Tools stack 12/7/92.  Sorry for the excessive
  4. duplication between different backgrounds.  Make sure you know exactly
  5. what you’re reading when you work with this. -Simon St.Laurent
  6.  
  7. •-•-•-• STACK: Hypertype 1.5 •-•-•-•
  8.  
  9. •-•-•-• STACK SCRIPT: •-•-•-•
  10.  
  11. on openStack
  12.   global viz
  13.   -- sets visual effects on/off for stack: 1=on, 2=off
  14.   hide menuBar
  15.   set scriptTextFont to "N Helvetica Narrow"
  16.   set scriptTextSize to 12
  17.   push first card
  18.   push first card
  19.   push first card
  20.   if the hilite of card button id 12 of card id 2843 is false then put 2 into viz else put 1 into viz
  21.   set the dontSearch of card id 2843 to true
  22.   set the dontSearch of card "Help 1" to true
  23. end openStack
  24.  
  25. on neWline
  26.   put the userLevel into current
  27.   set the userLevel to 5
  28.   ask "name of line?"
  29.   put it into lname
  30.   if lname is empty then exit neWline
  31.   lock screen
  32.   -- put l(ine)name into the lines field
  33.   go to card id 2843
  34.   set the lockText of card field 3 to false
  35.   put the number of lines in card field 3 into muck
  36.   put lname into line muck+1 of card field 3
  37.   set the lockText of card field 3 to true
  38.   go to card "base 1"
  39.   doMenu "new card"
  40.   set the name of this card to lname & " 1"
  41.   go to previous card
  42.   go to next card
  43.   set the userlevel to current
  44. end neWline
  45.  
  46. on hyPerize
  47.   set the cursor to watch
  48.   put the number of lines in card field 3 of card id 2843 into trips
  49.   set lockMessages to true
  50.   repeat with x=1 to trips
  51.     unmark all cards
  52.     put line x of card field 3 of card id 2843 into sstr
  53.     -- sstr is search string
  54.     mark cards by finding sstr
  55.     go to card id 2843
  56.     repeat with y=1 to number of marked cards
  57.       go to the next marked card
  58.       find whole sstr
  59.       put the foundChunk into firs
  60.       select the foundChunk
  61.       doMenu "plain"
  62.       doMenu "bold"
  63.       doMenu "italic"
  64.       doMenu "group"
  65.       select after firs
  66.       -- this section temporarily deleted.  Need to figure out how to search multiple times within
  67.       -- the same field of a card.
  68.       -- repeat
  69.       --   find whole sstr
  70.       --   put the foundChunk into zip
  71.       --   if zip=firs then exit repeat
  72.       --  select the foundChunk
  73.       --   doMenu "plain"
  74.       --    doMenu "bold"
  75.       --   doMenu "italic"
  76.       --   doMenu "group"
  77.       --   select after zip
  78.       --  end repeat
  79.     end repeat
  80.   end repeat
  81. end hyPerize
  82.  
  83.  
  84.  
  85. •-•-•-• BACKGROUND SCRIPT: hypertype •-•-•-•
  86.  
  87. on openCard
  88.   put the short name of this card into place
  89.   put last char of place into num
  90.   if num=1 then
  91.     hide bg button 3
  92.     delete last char of place
  93.   else
  94.     show bg button 3
  95.   end if
  96.   put place into field "headline"
  97.   if num<>1 then delete last char of place
  98.   put num+1 into check
  99.   if there is a card place & check then
  100.     show bg button 4
  101.     hide bg button id 15
  102.   else
  103.     hide bg button 4
  104.     show bg button id 15
  105.   end if
  106. end openCard
  107.  
  108. on newCard
  109.   get line one of card field six of card id 2843
  110.   put it && the date into field Author
  111. end newCard
  112.  
  113. on cardMake
  114.   put the short name of this card into place
  115.   put the last char of place into num
  116.   delete last char of place
  117.   put num+1 into new
  118.   if there is a card place & new then
  119.     answer "you must be on the last card of a section to create a new card."
  120.   else
  121.     lock screen
  122.     doMenu "new card"
  123.     set the name of this card to place & new
  124.     go back
  125.     set lockScreen to false
  126.     go to card place & new
  127.   end if
  128. end cardMake
  129.  
  130. on controlKey key
  131.   if key is 2 then doMenu "bold"
  132.   if key is 9 then doMenu "italic"
  133.   if key is 21 then doMenu "underline"
  134.   if key is 14 or key is 16 then doMenu "plain"
  135.   if key is 7 then doMenu "group"
  136. end controlKey
  137.  
  138.  
  139. •-•-•-• BACKGROUND BUTTON SCRIPTS •-•-•-•
  140.  
  141. •-•-•-• BUTTON: bkgnd button "Backbranch "
  142.  
  143. on mouseUp
  144.   global viz
  145.   if viz=1 then visual effect zoom in
  146.   pop card
  147. end mouseUp
  148.  
  149. •-•-•-• BUTTON: bkgnd button "escape!"
  150.  
  151. on mouseUp
  152.   if this is the first card then
  153.     answer "Do you want to quit?" with "Yes" or "No"
  154.     if it is "yes" then doMenu "quit"
  155.     wait 1
  156.   else
  157.     push card
  158.     go to first card
  159.   end if
  160. end mouseUp
  161.  
  162. •-•-•-• BUTTON: bkgnd button "last card"
  163.  
  164. on mouseUp
  165.   global viz
  166.   if viz=1 then visual effect scroll right
  167.   put the short name of this card into place
  168.   put the last char of place into number
  169.   delete the last char of place
  170.   put number-1 into dest
  171.   go to card place & dest
  172. end mouseUp
  173.  
  174. •-•-•-• BUTTON: bkgnd button "next card"
  175.  
  176. on mouseUp
  177.   global viz
  178.   if viz=1 then visual effect scroll left
  179.   put the short name of this card into place
  180.   put the last char of place into number
  181.   delete the last char of place
  182.   put number+1 into dest
  183.   go to card place & dest
  184. end mouseUp
  185.  
  186. •-•-•-• BUTTON: bkgnd button "New Card"
  187.  
  188. on mouseUp
  189.   cardMake
  190. end mouseUp
  191.  
  192. •-•-•-• BUTTON: bkgnd button "New Line"
  193.  
  194. on mouseUp
  195.   push card
  196.   neWline
  197. end mouseUp
  198.  
  199. •-•-•-• BUTTON: bkgnd button "Show Footnotes"
  200.  
  201. on mouseUp
  202.   doMenu "background"
  203.   if the visible of background field 5 is true then
  204.     set the visible of background field 5 to false
  205.     set the visible of background button id 20 to false
  206.   else
  207.     set the visible of background field 5 to true
  208.     set the visible of background button id 20 to true
  209.   end if
  210.   doMenu "background"
  211. end mouseUp
  212.  
  213. •-•-•-• BUTTON: bkgnd button "Open Body"
  214.  
  215. on mouseUp
  216.   doMenu "background"
  217.   if the lockText of background field 2 is true then set the lockText of background field 2 to false else set the lockText of background field 2 to true
  218.   doMenu "background"
  219. end mouseUp
  220.  
  221. •-•-•-• BUTTON: bkgnd button "help"
  222.  
  223. on mouseUp
  224.   push card
  225.   go to card "Help 1"
  226. end mouseUp
  227.  
  228. •-•-•-• BUTTON: bkgnd button "Lock Footnotes"
  229.  
  230. on mouseUp
  231.   doMenu "background"
  232.   if the lockText of background field 5 is true then set the lockText of background field 5 to false¬
  233.   else set the lockText of background field 5 to true
  234.   doMenu "background"
  235. end mouseUp
  236.  
  237. •-•-•-• BUTTON: bkgnd button "escape!"
  238.  
  239. on mouseUp
  240.   put the id of the first card into it
  241.   if the id of this card = it then
  242.     answer "Do you want to quit?" with "Yes" or "No"
  243.     if it is "yes" then doMenu "quit"
  244.     wait 1
  245.   else
  246.     push card
  247.     go to first card
  248.   end if
  249. end mouseUp
  250.  
  251. •-•-•-• BUTTON: bkgnd button "escape!"
  252.  
  253. on mouseUp
  254.   put the id of the first card into it
  255.   if the id of this card = it then
  256.     answer "Do you want to quit?" with "Yes" or "No"
  257.     if it is "yes" then doMenu "quit hypercard"
  258.     wait 1
  259.   else
  260.     push card
  261.     go to first card
  262.   end if
  263. end mouseUp
  264.  
  265. •-•-•-• BACKGROUND FIELD SCRIPTS •-•-•-•
  266.  
  267. •-•-•-• FIELD: bkgnd field "Body"
  268.  
  269. on mouseUp
  270.   global viz
  271.   put the clickText into place
  272.   put place & " 1" into test
  273.   if test is " 1" then wait 1
  274.   else
  275.     put the short name of this card into junk
  276.     delete the last word of junk
  277.     if junk <> place then
  278.       if there is a card test then
  279.         push card
  280.         if viz=1 then visual effect zoom out
  281.         go to card test
  282.       end if
  283.     else
  284.       wait 1
  285.     end if
  286.   end if
  287. end mouseUp
  288.  
  289. •-•-•-• FIELD: bkgnd field "footnote"
  290.  
  291. on mouseUp
  292.   
  293. end mouseUp
  294.  
  295.  
  296. •-•-•-• BACKGROUND SCRIPT: hypertype •-•-•-•
  297.  
  298. on openCard
  299.   put the short name of this card into place
  300.   put last char of place into num
  301.   if num=1 then
  302.     hide bg button 3
  303.     delete last char of place
  304.   else
  305.     show bg button 3
  306.   end if
  307.   put place into field "headline"
  308.   if num<>1 then delete last char of place
  309.   put num+1 into check
  310.   if there is a card place & check then
  311.     show bg button 4
  312.     hide bg button id 15
  313.   else
  314.     hide bg button 4
  315.     show bg button id 15
  316.   end if
  317. end openCard
  318.  
  319. on newCard
  320.   get line one of card field six of card id 2843
  321.   put it && the date into field Author
  322. end newCard
  323.  
  324. on cardMake
  325.   put the short name of this card into place
  326.   put the last char of place into num
  327.   delete last char of place
  328.   put num+1 into new
  329.   if there is a card place & new then
  330.     answer "you must be on the last card of a section to create a new card."
  331.   else
  332.     lock screen
  333.     doMenu "new card"
  334.     set the name of this card to place & new
  335.     go back
  336.     set lockScreen to false
  337.     go to card place & new
  338.   end if
  339. end cardMake
  340.  
  341. on controlKey key
  342.   if key is 2 then doMenu "bold"
  343.   if key is 9 then doMenu "italic"
  344.   if key is 21 then doMenu "underline"
  345.   if key is 14 or key is 16 then doMenu "plain"
  346.   if key is 7 then doMenu "group"
  347. end controlKey
  348.  
  349.  
  350. •-•-•-• BACKGROUND BUTTON SCRIPTS •-•-•-•
  351.  
  352. •-•-•-• BUTTON: bkgnd button "Backbranch "
  353.  
  354. on mouseUp
  355.   global viz
  356.   if viz=1 then visual effect zoom in
  357.   pop card
  358. end mouseUp
  359.  
  360. •-•-•-• BUTTON: bkgnd button "escape!"
  361.  
  362. on mouseUp
  363.   if this is the first card then
  364.     answer "Do you want to quit?" with "Yes" or "No"
  365.     if it is "yes" then doMenu "quit"
  366.     wait 1
  367.   else
  368.     push card
  369.     go to first card
  370.   end if
  371. end mouseUp
  372.  
  373. •-•-•-• BUTTON: bkgnd button "last card"
  374.  
  375. on mouseUp
  376.   global viz
  377.   if viz=1 then visual effect scroll right
  378.   put the short name of this card into place
  379.   put the last char of place into number
  380.   delete the last char of place
  381.   put number-1 into dest
  382.   go to card place & dest
  383. end mouseUp
  384.  
  385. •-•-•-• BUTTON: bkgnd button "next card"
  386.  
  387. on mouseUp
  388.   global viz
  389.   if viz=1 then visual effect scroll left
  390.   put the short name of this card into place
  391.   put the last char of place into number
  392.   delete the last char of place
  393.   put number+1 into dest
  394.   go to card place & dest
  395. end mouseUp
  396.  
  397. •-•-•-• BUTTON: bkgnd button "New Card"
  398.  
  399. on mouseUp
  400.   cardMake
  401. end mouseUp
  402.  
  403. •-•-•-• BUTTON: bkgnd button "New Line"
  404.  
  405. on mouseUp
  406.   push card
  407.   neWline
  408. end mouseUp
  409.  
  410. •-•-•-• BUTTON: bkgnd button "Show Footnotes"
  411.  
  412. on mouseUp
  413.   doMenu "background"
  414.   if the visible of background field 5 is true then
  415.     set the visible of background field 5 to false
  416.     set the visible of background button id 20 to false
  417.   else
  418.     set the visible of background field 5 to true
  419.     set the visible of background button id 20 to true
  420.   end if
  421.   doMenu "background"
  422. end mouseUp
  423.  
  424. •-•-•-• BUTTON: bkgnd button "Open Body"
  425.  
  426. on mouseUp
  427.   doMenu "background"
  428.   if the lockText of background field 2 is true then set the lockText of background field 2 to false else set the lockText of background field 2 to true
  429.   doMenu "background"
  430. end mouseUp
  431.  
  432. •-•-•-• BUTTON: bkgnd button "help"
  433.  
  434. on mouseUp
  435.   push card
  436.   go to card "Help 1"
  437. end mouseUp
  438.  
  439. •-•-•-• BUTTON: bkgnd button "Lock Footnotes"
  440.  
  441. on mouseUp
  442.   doMenu "background"
  443.   if the lockText of background field 5 is true then set the lockText of background field 5 to false¬
  444.   else set the lockText of background field 5 to true
  445.   doMenu "background"
  446. end mouseUp
  447.  
  448. •-•-•-• BUTTON: bkgnd button "escape!"
  449.  
  450. on mouseUp
  451.   put the id of the first card into it
  452.   if the id of this card = it then
  453.     answer "Do you want to quit?" with "Yes" or "No"
  454.     if it is "yes" then doMenu "quit"
  455.     wait 1
  456.   else
  457.     push card
  458.     go to first card
  459.   end if
  460. end mouseUp
  461.  
  462. •-•-•-• BUTTON: bkgnd button "escape!"
  463.  
  464. on mouseUp
  465.   put the id of the first card into it
  466.   if the id of this card = it then
  467.     answer "Do you want to quit?" with "Yes" or "No"
  468.     if it is "yes" then doMenu "quit hypercard"
  469.     wait 1
  470.   else
  471.     push card
  472.     go to first card
  473.   end if
  474. end mouseUp
  475.  
  476. •-•-•-• BACKGROUND FIELD SCRIPTS •-•-•-•
  477.  
  478. •-•-•-• FIELD: bkgnd field "footnote"
  479.  
  480. on mouseUp
  481.   
  482. end mouseUp
  483.  
  484.  
  485. •-•-•-• CARD: start •-•-•-•
  486.  
  487. •-•-•-• CARD BUTTON SCRIPTS •-•-•-•
  488.  
  489. •-•-•-• BUTTON: card button id 4
  490.  
  491. on mouseUp
  492.   pop card
  493. end mouseUp
  494.  
  495. •-•-•-• BUTTON: card button "New Line"
  496.  
  497. on mouseUp
  498.   push card
  499.   neWline
  500. end mouseUp
  501.  
  502. •-•-•-• BUTTON: card button "Hypertextualize"
  503.  
  504. on mouseUp
  505.   hyPerize
  506. end mouseUp
  507.  
  508. •-•-•-• BUTTON: card button "Visual Effects"
  509.  
  510. on mouseUp
  511.   global viz
  512.   if the hilite of card button id 12 is true then
  513.     set the hilite of card button id 12 to false
  514.     put 2 into viz
  515.   else
  516.     set the hilite of card button id 12 to true
  517.     put 1 into viz
  518.   end if
  519. end mouseUp
  520.  
  521. •-•-•-• BUTTON: card button "Export Text to file"
  522.  
  523. on mouseUp
  524.   ask file "Create export file named:" with "hypertype export"
  525.   If it is empty then exit mouseUp
  526.   set the cursor to watch
  527.   put it into fileName
  528.   open file fileName
  529.   push card
  530.   lock screen
  531.   set lockMessages to true
  532.   repeat with I=1 to the number of lines of card field "lines" --cards of bg id 4345
  533.     put line I of card field "lines" of card id 2843 into heads
  534.     write heads to file fileName
  535.     write return to file fileName
  536.     put 1 into count
  537.     put empty into foot
  538.     repeat
  539.       if there is a card heads && count then
  540.         go to card heads && count
  541.         put field "body" into place
  542.         if field "footnote" is not empty then put foot & return & field "footnote" into foot
  543.         write place & " " to file fileName
  544.       else
  545.         exit repeat
  546.       end if
  547.       put count+1 into count
  548.     end repeat
  549.     write return to file fileName
  550.     if foot is not empty then write "Footnotes for " & heads & ":" & return & foot & return to file fileName
  551.     write return to file fileName
  552.   end repeat
  553.   close file fileName
  554.   pop card
  555.   unlock screen
  556.   beep 1
  557.   answer "The export file is complete."
  558. end mouseUp
  559.  
  560. •-•-•-• BUTTON: card button "shadow fields"
  561.  
  562. on mouseUp
  563.   set the hilite of card button id 14 to true
  564.   set the hilite of card button id 15 to false
  565.   push this card
  566.   lock screen
  567.   go to card "Base 1"
  568.   set the style of bg field "Body" to shadow
  569.   pop card
  570. end mouseUp
  571.  
  572. •-•-•-• BUTTON: card button "scrolling fields"
  573.  
  574. on mouseUp
  575.   set the hilite of card button id 15 to true
  576.   set the hilite of card button id 14 to false
  577.   push this card
  578.   lock screen
  579.   go to card "Base 1"
  580.   set the style of bg field "Body" to scrolling
  581.   pop card
  582. end mouseUp
  583.  
  584. •-•-•-• BUTTON: card button "Delete line"
  585.  
  586. on mouseUp
  587.   ask "which line?"
  588.   put it into heads
  589.   if heads is empty then exit mouseUp
  590.   lock screen
  591.   push card
  592.   set the dontSearch of cd field "lines" to false
  593.   set the dontSearch of cd id 2843 to false
  594.   find heads in cd field "lines"
  595.   put the foundLine into muck
  596.   if muck is empty then exit mouseUp
  597.   delete the foundLine
  598.   set the dontSearch of cd field "lines" to true
  599.   set the dontSearch of cd id 2843 to true
  600.   put 1 into count
  601.   -- delete loop
  602.   repeat
  603.     if there is a card heads && count then
  604.       go to card heads && count
  605.       doMenu "delete card"
  606.     else
  607.       exit repeat
  608.     end if
  609.     put count+1 into count
  610.   end repeat
  611.   -- unhypertextualize
  612.   unmark all cards
  613.   mark cards by finding sstr
  614.   go to card id 2843
  615.   repeat with y=1 to number of marked cards
  616.     go to the next marked card
  617.     find whole sstr
  618.     put the foundChunk into firs
  619.     select the foundChunk
  620.     doMenu "plain"
  621.   end repeat
  622.   pop card
  623.   answer heads && "has been deleted."
  624. end mouseUp
  625.  
  626. •-•-•-• BUTTON: card button "Change line name"
  627.  
  628. on mouseUp
  629.   ask "which line?"
  630.   put it into heads
  631.   -- heads variable short for headline
  632.   if heads is empty then exit mouseUp
  633.   ask "change it to what?" with heads
  634.   put it into new
  635.   --new line name
  636.   if new is empty then exit mouseUp
  637.   lock screen
  638.   push card
  639.   set the dontSearch of cd field "lines" to false
  640.   set the dontSearch of cd id 2843 to false
  641.   -- nuisance allowing search on control card
  642.   find heads in cd field "lines"
  643.   put the foundChunk into muck
  644.   -- muck a variable name born of frustration
  645.   if muck is empty then
  646.     answer "no such line"
  647.     exit mouseUp
  648.   end if
  649.   select the foundChunk
  650.   put new into the selection
  651.   put 1 into count
  652.   repeat
  653.     --heads && count will produce a sequence of card names in a line
  654.     if there is a card heads && count then
  655.       go to card heads && count
  656.       set the name of this card to new && count
  657.     else
  658.       exit repeat
  659.     end if
  660.     put count+1 into count
  661.   end repeat
  662.   pop card
  663.   answer heads && "has been changed to" && new & "."
  664.   set the dontSearch of cd field "lines" to true
  665.   set the dontSearch of cd id 2843 to true
  666. end mouseUp
  667.  
  668. •-•-•-• BUTTON: card button "Hide first card"
  669.  
  670. on mouseUp
  671.   answer "This is intended only for when you are finished creating a stack.  Are you finished?"¬
  672.   with "yes" or "no"
  673.   if it is "no" then exit mouseUp
  674.   put the first line of card field "lines" into suggestion
  675.   ask "Which line do want to use as the first line?" with suggestion
  676.   put it into newfir
  677.   -- new is new first card
  678.   if newfir is empty then exit mouseUp
  679.   if there is no card newfir && "1" then
  680.     answer "No such line!"
  681.     exit mouseUp
  682.   end if
  683.   go to card newfir && "1"
  684.   doMenu "cut card"
  685.   go to first card
  686.   doMenu "paste card"
  687.   go to first card
  688.   doMenu "cut card"
  689.   go to last card
  690.   doMenu "paste card"
  691.   go to first card
  692.   answer "Finished.  If you still need access to the main card, type Command-M to summon the Message box, then type 'go to card id 2843'."
  693. end mouseUp
  694.  
  695. •-•-•-• BUTTON: card button "Quit"
  696.  
  697. on mouseUp
  698.   answer "Do you want to quit?" with "Yes" or "No"
  699.   if it is "yes" then doMenu "quit hypercard"
  700. end mouseUp
  701.  
  702. •-•-•-• CARD FIELD SCRIPTS •-•-•-•
  703.  
  704. •-•-•-• FIELD: card field "Lines"
  705.  
  706. on mouseUp
  707.   put the clickText into place
  708.   push card
  709.   put place & " 1" into dest
  710.   go to card dest
  711. end mouseUp
  712.  
  713. •-•-•-• CARD: Help 1 •-•-•-•
  714.  
  715. •-•-•-• CARD BUTTON SCRIPTS •-•-•-•
  716.  
  717. •-•-•-• BUTTON: card button "escape!"
  718.  
  719. on mouseUp
  720.   put the id of the first card into it
  721.   if the id of this card = it then
  722.     answer "Do you want to quit?" with "Yes" or "No"
  723.     if it is "yes" then doMenu "quit hypercard"
  724.     wait 1
  725.   else
  726.     push card
  727.     go to first card
  728.   end if
  729. end mouseUp
  730.  
  731. •-•-•-• BUTTON: card button "last card"
  732.  
  733. on mouseUp
  734.   
  735. end mouseUp
  736.  
  737. •-•-•-• BUTTON: card button "next card"
  738.  
  739. on mouseUp
  740.   
  741. end mouseUp
  742.  
  743. •-•-•-• BUTTON: card button "escape!"
  744.  
  745. on mouseUp
  746.   
  747. end mouseUp
  748.  
  749. •-•-•-• BUTTON: card button "About this stack"
  750.  
  751. on mouseUp
  752.   show card field "About"
  753. end mouseUp
  754.  
  755. •-•-•-• BUTTON: card button "end help"
  756.  
  757. on mouseUp
  758.   pop card
  759. end mouseUp
  760.  
  761. •-•-•-• BUTTON: card button "Backbranch "
  762.  
  763. on mouseUp
  764.   
  765. end mouseUp
  766.  
  767. •-•-•-• CARD FIELD SCRIPTS •-•-•-•
  768.  
  769. •-•-•-• FIELD: card field "About"
  770.  
  771. on mouseUp
  772.   hide card field "About"
  773. end mouseUp
  774.  
  775.  
  776.